Displays a prompt in a dialog at which the user can input text. The input is assigned to a variable.
ユーザーによるテキスト入力を行うためのダイアログを表示します。入力された値は、変数に収める必要があります。
The InputBox statement is a convenient method of entering text through a dialog. Confirm the input by clicking OK or pressing Return. The input is returned as the function return value. If you close the dialog with Cancel, InputBox returns a zero-length string ("").
InputBox ステートメントを利用することで、ダイアログによるユーザー入力を簡単に実装できます。ユーザーの入力する値は、OK ボタンをクリックするか Return キーを押した段階で確定されます。こうして得られる入力値は、一種の関数の戻り値として返されます。また、Cancel ボタンをクリックしてダイアログを閉じると、InputBox は文字長ゼロの空白文字列 ("") を返します。
InputBox (Msg As String[, Title As String[, Default As String[, x_pos As Integer, y_pos As Integer]]]])
InputBox (Msg As String[, Title As String[, Default As String[, x_pos As Integer, y_pos As Integer]]]])
String
文字列
Msg: String expression displayed as the message in the dialog box.
Msg:ダイアログボックスにメッセージとして表示させる文字列。
Title: String expression displayed in the title bar of the dialog box.
Title:ダイアログボックスのタイトルバーに表示させる文字列。
Default: String expression displayed in the text box as default if no other input is given.
Default:ユーザーが何も入力しない場合のデフォルト値としてテキストボックスに表示させる文字列。
x_pos: Integer expression that specifies the horizontal position of the dialog. The position is an absolute coordinate and does not refer to the window of the office application.
x_pos:ダイアログの水平位置を指定する整数表式。この位置指定は絶対座標によるもので、オフィスアプリケーションウィンドウに対するものではありません。
y_pos: Integer expression that specifies the vertical position of the dialog. The position is an absolute coordinate and does not refer to the window of the office application.
y_pos:ダイアログの垂直位置を指定する整数値。この位置指定は絶対座標によるもので、オフィスアプリケーションウィンドウに対するものではありません。
If x_pos and y_pos are omitted, the dialog is centered on the screen. The position is specified in twips.
x_pos および y_pos を省略した場合、ダイアログは画面中央に配置されます。位置の指定単位は twip です。
Sub ExampleInputBox
Sub ExampleInputBox
Dim sText As String
Dim sText As String
sText = InputBox ("Please enter a phrase:","Dear User")
sText = InputBox ("フレーズを入力してください: ","ようこそ")
MsgBox ( sText , 64, "Confirmation of phrase")
MsgBox ( sText , 64, "Confirmation of phrase")
End Sub
End Sub